package com.wanmait.schedule.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wanmait.schedule.entity.Config;
import com.wanmait.schedule.mapper.ConfigMapper;
import com.wanmait.schedule.service.ConfigService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 配置信息表 服务实现类
 * </p>
 *
 * @author wanmait
 * @since 2022-03-02
 */
@Service
public class ConfigServiceImpl extends ServiceImpl<ConfigMapper, Config> implements ConfigService {

    @Resource
    private ConfigMapper configMapper;

    @Override
    public List<Config> configs() {//取出config里面额所有信息
        List<Config> configs = configMapper.configs();
        return configs;
    }

    @Override
    public void delectConfig(Integer id) {//逻辑删除
        configMapper.deleteById(id);
    }//逻辑删除

    @Override
    public void recoverConfig(Integer id) {//恢复显示状态
        configMapper.recoverConfig(id);
    }

    @Override
    public void updateConfig(Integer id, String username) {//修改内容
        Config config = new Config();
        config.setId(id);
        config.setValue(username);
        configMapper.updateById(config);
    }

    @Override
    public List<Config> findUserConfig() {//用户看到的菜单
        List<Config> userconfigs=configMapper.userConfig();
        return userconfigs;
    }
}
